package com.huyanqi.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huyanqi.core.util.JsonUtil;
import com.huyanqi.entity.User;
import com.huyanqi.service.UserService;

@Controller
public class UserController {

	private UserService userService;
	
	
	public UserService getUserService() {
		return userService;
	}

    @Resource(name="UserService")
	public void setUserService(UserService userService) {
		this.userService = userService;
	}


	@RequestMapping("/go.do")
	@ResponseBody
	public String go(){
		List<User> users = null;
		try {
			users = userService.getAllUser();
			//System.out.println(JsonUtil.list2json(users));
		} catch (Exception e) {
			e.printStackTrace();
		}
	
		return  JsonUtil.list2json(users);
	}
	
}
